package wang.hu.bos.service.Impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import wang.hu.bos.dao.CourierDao;
import wang.hu.bos.domain.base.Courier;
import wang.hu.bos.service.CourierService;

@Service
@Transactional
public class CourierServiceImpl implements CourierService {
	@Autowired
	private CourierDao courierDao;

	@Override
	public void save(Courier courier) {
		courier.setDeltag('2');
		courierDao.save(courier);

	}

	@Override
	public Page<Courier> findPageData(Specification<Courier> specification,
			Pageable pageable) {

		return courierDao.findAll(specification, pageable);
	}

	@Override
	public void delBatch(String[] ids, Character status) {
		for (String id : ids) {
			Courier courier = courierDao.findOne(Integer.parseInt(id));
			courier.setDeltag(status);
		}

	}

}
